/**
 * Created with IntelliJ IEDA.
 * Description:
 * User:86186
 * Date:2023-03-19
 * Time:15:30
 */

/**
 * 力扣9：回文数
 */
public class isPalindrome {
    public boolean isPalindrome(int x) {
        if ((x < 0) || (x % 10 == 10 && x != 0)){
            return false;
        }
        //反转一半数字
        int rev = 0;
        while (x > rev){
            rev = rev * 10 + x % 10;
            x /= 10;
        }
        return x == rev / 10 || x == rev;
    }
}
